package model

import "gpt-api/framework/db"

type Province struct {
	db.BaseModel
	Code string `json:"code" gorm:"column:code;type:varchar(255);default:'';comment:code"`
	Name string `json:"name" gorm:"column:name;type:varchar(255);default:'';comment:name"`
}

func (Province) TableName() string {
	return "province"
}

// 查询所有省
func (m Province) GetProvinceAll(database *db.DB) ([]Province, error) {
	var province []Province
	err := database.Model(&Province{}).Find(&province).Error
	return province, err
}
